package www.bw.com.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import www.bw.com.beans.User;
import www.bw.com.dao.UserMapper;
import www.bw.com.service.UserService;

import java.util.HashSet;
import java.util.Set;

@Service
public class UserServiceImpl implements UserService {


    @Autowired
    private UserMapper userMapper;


    @Override
    public Set<String> findRolesByUserName(String username) {
        Set<String> roles=userMapper.findRolesByUserName(username);
        return roles==null?new HashSet<>():roles;
    }

    @Override
    public Set<String> findPermissionsByUserName(String username) {
      Set<String> permissions=userMapper.findPermissionsByUserName(username);
        return permissions==null?new HashSet<>():permissions;
    }

    @Override
    public User findUserByUserName(String username) {
        return userMapper.findUserByUserName(username);
    }


}
